/****************************************************
          File Name:10-5.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Tue 23 Dec 2014 03:52:16 PM CST
*****************************************************/

#include"10-5.h"
#include<iostream>

using std::cout;
using std::cin;

int main()
{
    Stack mine; // construct implicitly
    Item person;
    double total = 0;

    cout << "\n++++++PUSH elements++++++\n";

    for(;!mine.isfull();)
    {
        cout << "Enter your name: ";
        cin.getline(person.fullname, 35);
        cout << "Enter your payment: ";
        (cin >> person.payment).get();

        // push into Stack
        mine.push(person);
        // clear fullname
        for(int i = 0; i < 35; i++) person.fullname[i] = '\0';
    }

    cout << "\n--------POP elements---------\n";

    for(;!mine.isempty();)
    {
        mine.pop(person);

        cout << "Name:\t";
        cout << person.fullname << "\n";
        cout << "Payment:\t";
        cout << person.payment << "\n";
        total += person.payment;
    }

    cout << "Total Payment is: " << total << "\n";

    return 0;
}
